import React, { useEffect, useState } from 'react'
import { Card, Avatar, Descriptions } from 'antd'
import { UserOutlined } from '@ant-design/icons';
import { getMyStudent } from '../../api/myStudent'
import './index.scss'

const { Meta } = Card;
const App = () => {
    const [studentList, setStudentList] = useState([])
    useEffect(() => {
        getMyStudent({ adminname: '123' }).then(res => {
            // console.log(res.data.data);
            setStudentList(res.data.data)
        })
    }, [])

    return (
        <div className='studentBox'>
            {
                studentList && studentList.map((item, index) => {
                    return (
                        <Card
                            key={index}
                            style={{ width: 300, marginTop: 16, }}
                            loading={false}
                        >
                            <span className='subject'>{item.subject}</span>
                            <Meta
                                avatar={<Avatar icon={<UserOutlined />} />}
                                title={item.name}
                            />
                            <hr />
                            <Descriptions 
                                column={1}
                                contentStyle={{marginTop:'15px'}}
                                labelStyle={{color:'gray'}}
                            >
                                <Descriptions.Item label="年级">{item.grade}</Descriptions.Item>
                                <Descriptions.Item label="手机号">{item.phone}</Descriptions.Item>
                                <Descriptions.Item label="学校">{item.school}</Descriptions.Item>
                                <Descriptions.Item label="班主任">{item.teacher}</Descriptions.Item>
                                <Descriptions.Item label="购课时间">{item.buyTime}</Descriptions.Item>
                            </Descriptions>
                        </Card>
                    )
                })
            }
        </div>
    )
}
export default App